package conexao;


import gui.Geral;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

import basicas.Aluno;

public class BibliotecaConn implements Runnable {
	private Socket socket;
	private ObjectInputStream in = null;
	private ObjectOutputStream out = null;
	private Geral guiGeral;
	
	
	public BibliotecaConn(Socket socket, Geral guiGeral) throws IOException {
		this.socket = socket;
		this.guiGeral = guiGeral;
		
		out = new ObjectOutputStream(new DataOutputStream(socket.getOutputStream()));
		in = new ObjectInputStream(new DataInputStream(socket.getInputStream()));
		

	}

	public void run() {
		Aluno aluno = null;
		/*try {*/
			switch (guiGeral.getGui()) {
			case "aluno":
				switch (guiGeral.getAcao()) {
				case "addaluno":
					//out.writeObject(guiGeral.getAluno());
					//aluno = (Aluno) in.readObject();
					//out.writeInt(999);
					//System.out.println(in.readInt());
					
					aluno = new Aluno(10001, "Carlos Melo");
					aluno.setCpf("jajaja");
					guiGeral.adicionarAluno(aluno);
					break;

				default:
					break;
				}
				break;
				
			case "livro":
				break;
				
			case "locacao":
				break;
				
			default:
				break;
			}
			
		/*} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/

		
	}
}
